/**
 * Created by chenlili on 2017/6/15.
 */
window.onload= upLoad('bendi1','showpic1','picBottlle1')

function upLoad(a,b,c)
{
    var bendi=document.getElementById(a);
    var showpic=document.getElementById(b);
    var picBottlle=document.getElementById(c);

    showpic.onclick=function()
    {
        var fileList=bendi.files;

        for(var i=0;i<fileList.length;i++)
        {
            if( fileList[i].type.indexOf('image') != -1 )
            {
                var fd=new FileReader();

                fd.readAsDataURL( fileList[i] );

                fd.onload=function()
                {
                    var oLi=document.createElement('li');

                    var oImg=document.createElement('img');

                    oImg.src=this.result;
                    oImg.setAttribute('onOff',1);

                    oLi.appendChild(oImg);

                    picBottlle.insertBefore(oLi,picBottlle.children[0]);
                };
            }
            else
            {
                alert('您上传的不是图片，请上传一张图片；');
            };
        };
    };
};
